BETWEEN Operator
The between command is used in the where clause to check for a range. It verifies whether the records have values within the specified range. This is typically combined with the and command.
For Example:
select * from employees where job_id between 5 and 9;
The above code will check for employees whose job_id falls within the range of 5 to 9. It matches exact values.
Alternatively, the same result can be achieved using the following SQL code:
select * from employees where job_id >= 5 and job_id <= 9;
Result:

As seen in the displayed records, the job_id values are between 5 and 9.
Ecto query for between
Ecto does not have a specific between function. However, you can filter your records within a particular range using the fragement/1, as described in the fragment, or by utilizing comparison operators.